package com.dqyt.khjc.mapper;

import com.dqyt.khjc.bean.CustomerUserBean;
import com.dqyt.khjc.bean.ResultMsg;
import org.apache.ibatis.annotations.Param;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 *待审核申请
 */
@EnableAutoConfiguration
public interface CustomerUserMapper {
    /**
     * 分页查询  客户管理-待审核申请
     *
     * @param page
     * @param size
     * @param userName
     * @param phone
     * @param customerId
     * @param statue
     * @return
     */
    public List<CustomerUserBean> getReviewApplyList(@Param("page") Integer page,
                                                     @Param("size") Integer size,
                                                     @Param("userName")String userName,
                                                     @Param("phone")String phone,
                                                     @Param("customerId")long customerId,
                                                     @Param("statue")int statue);

    /**
     * 查询总条数
     * @param userName
     * @param phone
     * @param customerId
     * @param statue
     * @return
     */
    public Long getTotalNumber(@Param("userName")String userName,
                               @Param("phone")String phone,
                               @Param("customerId")long customerId,
                               @Param("statue")int statue);

    /**
     * 批量处理 待申请的请求
     * @param ids
     * @return
     */
    public  int  batchHandle(int[] ids,int statue);


    /**
     * 批量拒绝
     * @param ids   id数组
     * @param refuseReason 拒绝理由
     * @return
     */
    public int batchRefuse(int[] ids, String refuseReason);


    /**
     * 添加客户人员信息
     * @return
     */
    public  int addCustomerUser(CustomerUserBean customerUserBean);

    /**
     * 修改
     * @param customerUserBean
     * @return
     */
    public int updateCustomerUser(CustomerUserBean customerUserBean);

    /**
     * 更具id查询客户人员信息
     * @return
     */
    public CustomerUserBean  getCustomerUserById(long customerUserId);



    /**
     * 更具手机查询
     * @return
     */
    public CustomerUserBean  getCustomerUserByphone(String phone);


    /**
     * 更具账号查询
     * @return
     */
    public CustomerUserBean  getCustomerUserByAccount(String account);




    /**
     * 分页查询  客户管理-客户人员信息一栏
     *
     * @param page
     * @param size
     * @param userName
     * @param phone
     * @param customerId
     * @return
     */
    public List<CustomerUserBean> getKhryxxApplys(@Param("page") Integer page,
                                                     @Param("size") Integer size,
                                                     @Param("userName")String userName,
                                                     @Param("phone")String phone,
                                                     @Param("customerId")long customerId,
                                                  int chId);

    /**
     * 查询总条数
     * @param userName
     * @param phone
     * @param customerId
     * @return
     */
    public Long getKhryxxTotalNumber(@Param("userName")String userName,
                               @Param("phone")String phone,
                               @Param("customerId")long customerId,int chId);

    /**
     * 允许登陆 / 禁止登陆  客户人员信息一栏
     *
     * @param customerUserId
     * @param statue    1:允许登陆    2限制登录
     * @return
     */
    public int loginKxryxxRes(long customerUserId, int statue);

    /**
     * 查询所属机构下面的人员列表
     * @param customerId
     * @return
     */
    public List<CustomerUserBean> getCuUsersByCuId(int customerId);


    public int deleteAllByChId(int chId);


    public int deleteAllByCustomerId(int customerId);
}
